<template>
  <div>
    <div class="tabCard">
      <div
        :class="{ tabName: true, activeTab: nowTab == 'receiveList' }"
        v-on:click="toChangeInfos"
      >
        样品接收
      </div>
      <div
        :class="{ tabName: true, activeTab: nowTab == 'auditList' }"
        v-on:click="toChangeData"
      >
        样品审核
      </div>
    </div>
    <div class="mainCon" v-loading="!isLoading">
      <div class="containercontent" v-if="nowTab == 'receiveList'">
        <div class="seachTip selectw100">
          <div class="inlineblock verticalmiddle searchitem">
            <div class="inlineblock verticalmiddle">状态</div>
            <div class="inlineblock verticalmiddle informationItem">
              <el-select
                v-model="sampleStateValue"
                placeholder="请选择"
                size="mini"
                @change="readTaskSample(sampleQuery, 'search')"
              >
                <el-option
                  v-for="item in sampleState"
                  :key="item.code"
                  :label="item.name"
                  :value="item.code"
                >
                </el-option>
              </el-select>
            </div>
          </div>
          <div class="inlineblock verticalmiddle searchitem">
            <div class="inlineblock verticalmiddle">任务</div>
            <div class="inlineblock verticalmiddle informationItem">
              <el-select
                v-model="taskListValue"
                size="mini"
                filterable
                @change="readTaskSample(sampleQuery, 'search')"
                clearable
                @focus="readAllTask"
              >
                <el-option
                  v-for="item in taskList"
                  :key="item.id"
                  :label="item.name"
                  :value="item.id"
                >
                </el-option>
              </el-select>
            </div>
          </div>

          <div class="inlineblock verticalmiddle searchitem">
            <div class="inlineblock verticalmiddle">采样人</div>
            <div class="inlineblock verticalmiddle informationItem">
              <el-select
                v-model="collectionMan"
                size="mini"
                filterable
                remote
                :remote-method="readUser"
                clearable
                @change="readTaskSample(sampleQuery, 'search')"
              >
                <el-option
                  v-for="item in userData"
                  :key="item.account"
                  :label="item.name"
                  :value="item.account"
                >
                </el-option>
              </el-select>
            </div>
          </div>
          <div class="inlineblock basicRightDistanceA searchIcon">
            <el-button
              size="mini"
              @click="readTaskSample(sampleQuery, 'search')"
              >搜索</el-button
            >
          </div>
          <div class="inlineblock basicRightDistanceA searchIcon">
            <el-button size="mini" @click="emptySearch">清空</el-button>
          </div>
        </div>
        <div class="separaterowTable">
          <div class="tableTittle">
            <div><span class="fontImpact">1</span><span>样品接收</span></div>
            <!-- {{sampleStateValue}} -->
            <el-tooltip
              class="item"
              effect="dark"
              content="只作用于本页勾选的样品"
              placement="bottom"
            >
              <el-button
                type="primary"
                size="mini"
                @click="acceptShow"
                style="float: right; margin-left: 10px"
                v-if="sampleStateValue == '3' && userOpernation.receive.display"
                >接收</el-button
              >
            </el-tooltip>
            <!-- <el-tooltip
              class="item"
              effect="dark"
              content="只作用于本页勾选的样品"
              placement="bottom"
            >
              <el-button
                type="primary"
                size="mini"
                @click="destroyShow"
                style="float: right; margin-left: 10px"
                v-if="sampleStateValue != '3'"
                >销毁</el-button
              >
            </el-tooltip> -->
            <el-tooltip
              class="item"
              effect="dark"
              content="只作用于本页勾选的样品"
              placement="bottom"
            >
              <el-button
                type="primary"
                size="mini"
                @click="changeInfo(1)"
                style="float: right; margin-left: 10px"
                v-if="sampleStateValue != '3'"
                >申请变更</el-button
              >
            </el-tooltip>
            <!-- <el-tooltip
              class="item"
              effect="dark"
              content="只作用于本页勾选的样品"
              placement="bottom"
            >
              <el-button
                type="primary"
                size="mini"
                @click="abandonReceive"
                style="float: right; margin-left: 10px"
                v-if="sampleStateValue == '3'"
                >放弃接收</el-button
              >
            </el-tooltip> -->
            <el-tooltip
              class="item"
              effect="dark"
              content="只作用于本页勾选的样品"
              placement="bottom"
            >
              <el-button
                type="primary"
                size="mini"
                @click="disLock"
                style="float: right; margin-left: 10px"
                v-if="sampleStateValue == '3'"
                >取消接收</el-button
              >
            </el-tooltip>
            <!-- <el-tooltip
              class="item"
              effect="dark"
              content="只作用于本页勾选的样品"
              placement="bottom"
            >
              <el-button
                type="primary"
                size="mini"
                @click="recoverReceive"
                style="float: right; margin-left: 10px"
                v-if="sampleStateValue != '3'"
                >恢复接收</el-button
              >
            </el-tooltip> -->
            <!-- sampleStateValue == '3' -->
            <el-tooltip
              class="item"
              effect="dark"
              content="只作用于本页勾选的样品"
              placement="bottom"
            >
              <el-button
                type="primary"
                size="mini"
                @click="exportData"
                style="float: right; margin-left: 10px"
                v-if="sampleStateValue == '4' && userOpernation.export.display"
                >导出</el-button
              >
            </el-tooltip>
            <!-- <el-tooltip
              class="item"
              effect="dark"
              content="只作用于本页勾选的样品"
              placement="bottom"
            >
              <el-button
                type="primary"
                size="mini"
                @click="scanPrint"
                style="float: right"
                v-if="sampleStateValue == '5' && userOpernation.print.display"
                >扫码打印</el-button
              >
            </el-tooltip> -->
            <el-tooltip
              class="item"
              effect="dark"
              content="只作用于本页勾选的样品"
              placement="bottom"
            >
              <el-button
                type="primary"
                size="mini"
                @click="printSample"
                style="float: right"
                v-if="userOpernation.print.display"
                >打印样品标签</el-button
              >
            </el-tooltip>
          </div>

          <!--v-if="sampleStateValue == '3'"-->
          <el-table :data="sampleTableDate" style="width: 100%" size="mini" class="tableCon" ref="multipleTable" @selection-change="handleSelectionChange"
            key="sampleTableDate">
            <el-table-column type="selection" width="38px" key="selection">
            </el-table-column>
            <el-table-column label="序号"  min-width="50px">
              <template slot-scope="scope">
                <!--{{scope.$index+1}} -->
                {{scope.$index+(sampleQuery.page - 1) * sampleQuery.pageCount + 1}}
              </template>
            </el-table-column>
            <el-table-column property="name" label="样品名称" min-width="150px" :show-overflow-tooltip="true">
            </el-table-column>
            <el-table-column property="code" label="样品编号" min-width="150px" :show-overflow-tooltip="true">
            </el-table-column>
            <el-table-column property="taskName" label="任务名称" :show-overflow-tooltip="true" min-width="100px">
            </el-table-column>
            <el-table-column property="propertyOne" label="性状" :show-overflow-tooltip="true" min-width="100px">
              <template slot-scope="scope">
                {{scope.row.propertyOne == "" || scope.row.propertyOne == undefined  ? '---':scope.row.propertyOne}}
              </template>
            </el-table-column>
            <el-table-column property="factDate" label="采样时间"  min-width="145px">
              <template slot-scope="scope">
                {{scope.row.factDate == "" || scope.row.factDate == undefined  ? '---':scope.row.factDate.split('.')[0]}}
              </template>
            </el-table-column>
            <el-table-column property="factManName" label="采样人" min-width="100px">
              <template slot-scope="scope">
                {{scope.row.factManName == "" || scope.row.factManName == undefined  ? '---':scope.row.factManName}}
              </template>
            </el-table-column>
            <el-table-column property="acceptManName" :key="Math.random()" label="预接收人" v-if="sampleStateValue == '3'" min-width="100px">
              <template slot-scope="scope">
                {{scope.row.acceptManName == "" || scope.row.acceptManName == undefined  ? '---':scope.row.acceptManName}}
              </template>
            </el-table-column>
            <el-table-column property="collectionLeaderName" label="现场负责人" min-width="90px">
              <template slot-scope="scope">
                {{scope.row.collectionLeaderName == "" || scope.row.collectionLeaderName == undefined  ? '---':scope.row.collectionLeaderName}}
              </template>
            </el-table-column>
            <el-table-column property="status" label="状态" :formatter="formatterStatus" min-width="90px">
            </el-table-column>
            <el-table-column label="接收人" property="acceptManName" :key="Math.random()" v-if="sampleStateValue == '4'" min-width="100px">
            </el-table-column>
            <el-table-column label="接收时间" :key="Math.random()" v-if="sampleStateValue == '4'" property="acceptDate"
              min-width="145px">
               <template slot-scope="scope">
                {{scope.row.acceptDate == "" || scope.row.acceptDate == undefined  ? '---':scope.row.acceptDate.split('.')[0]}}
              </template>
            </el-table-column>
            <el-table-column label="操作" :key="Math.random()" v-if="sampleStateValue == '4' && userOpernation.select.display" min-width="100px">
              <template slot-scope="scope">
                <el-button type="text" size="mini" @click="samlpeDetail(scope.row)">详情</el-button>
              </template>
            </el-table-column>
          </el-table>
          <div class="block changepages">
            <el-pagination
              @size-change="handleSizeChange"
              @current-change="handleCurrentChange"
              :current-page="sampleQuery.page"
              :page-sizes="[20, 50, 100, 500, 1000]"
              :page-size="sampleQuery.pageCount"
              layout="total, sizes, prev, pager, next, jumper"
              :total="rowNumber"
            >
            </el-pagination>
          </div>
        </div>
      </div>
      <div class="containercontent" v-if="nowTab == 'auditList'">
        <div class="seachTip selectw100">
          <div class="inlineblock verticalmiddle searchitem">
            <div class="inlineblock verticalmiddle">状态</div>
            <div class="inlineblock verticalmiddle informationItem">
              <el-select
                v-model="changeQuery.status"
                placeholder="请选择"
                size="mini"
                @change="findChangeList()"
              >
                <el-option
                  v-for="item in changeState"
                  :key="item.code"
                  :label="item.name"
                  :value="item.code"
                >
                </el-option>
              </el-select>
            </div>
          </div>
          <div class="inlineblock verticalmiddle searchitem">
            <div class="inlineblock verticalmiddle">审核人</div>
            <div class="inlineblock verticalmiddle informationItem">
              <el-select
                v-model="changeQuery.chekName"
                size="mini"
                filterable
                remote
                :remote-method="readUser"
                clearable
                @change="findChangeList()"
              >
                <el-option
                  v-for="item in userData"
                  :key="item.account"
                  :label="item.name"
                  :value="item.name"
                >
                </el-option>
              </el-select>
            </div>
          </div>
          <div class="inlineblock basicRightDistanceA searchIcon">
            <el-button size="mini" @click="findChangeList()">搜索</el-button>
          </div>
          <div class="inlineblock basicRightDistanceA searchIcon">
            <el-button size="mini" @click="emptyChangeSearch">清空</el-button>
          </div>
        </div>
        <div class="separaterowTable">
          <div class="tableTittle">
            <div><span class="fontImpact">1</span><span>样品接收</span></div>
            <el-tooltip
              class="item"
              effect="dark"
              content="只作用于本页勾选的样品"
              placement="bottom"
            >
              <!-- <el-button
                type="primary"
                size="mini"
                @click="changeInfo(2)"
                style="float: right; margin-left: 10px"
                v-if="changeQuery.status == '2'"
                >申请变更</el-button
              > -->
            </el-tooltip>
          </div>
          <el-table
            :data="changeTableDate"
            style="width: 100%; height: 85%"
            size="mini"
            class="tableCon"
            ref="multipleTable"
            @selection-change="handleSelectionChange"
            key="auditTableDate"
          >
            <!-- <el-table-column
              v-if="changeQuery.status == '2'"
              type="selection"
              width="38px"
              key="selection"
            >
            </el-table-column> -->
            <el-table-column label="序号" min-width="50px">
              <template slot-scope="scope">
                {{
                  scope.$index +
                  (sampleQuery.page - 1) * sampleQuery.pageCount +
                  1
                }}
              </template>
            </el-table-column>
            <el-table-column
              property="sampleName"
              label="样品名称"
              min-width="150px"
              :show-overflow-tooltip="true"
            >
            </el-table-column>
            <el-table-column
              property="newCode"
              label="样品编号"
              min-width="150px"
              :show-overflow-tooltip="true"
            >
            </el-table-column>
            <!-- <el-table-column
              property="factManName"
              label="采样人"
              min-width="100px"
            >
              <template slot-scope="scope">
                {{
                  scope.row.factManName == "" ||
                  scope.row.factManName == undefined
                    ? "---"
                    : scope.row.factManName
                }}
              </template>
            </el-table-column> -->
            <el-table-column
              property="factDate"
              label="采样时间"
              min-width="145px"
            >
              <template slot-scope="scope">
                {{
                  scope.row.factDate == "" || scope.row.factDate == undefined
                    ? "---"
                    : scope.row.factDate.split(".")[0]
                }}
              </template>
            </el-table-column>
            <!-- <el-table-column
              label="接收人"
              property="acceptManName"
              min-width="100px"
              key="acceptManName1"
            >
            </el-table-column> -->
            <el-table-column
              label="接收时间"
              :key="Math.random()"
              property="acceptDate"
              min-width="145px"
            >
              <template slot-scope="scope">
                {{
                  scope.row.acceptDate == "" ||
                  scope.row.acceptDate == undefined
                    ? "---"
                    : scope.row.acceptDate.split(".")[0]
                }}
              </template>
            </el-table-column>
            <!-- <el-table-column
              property="propertyTwo"
              label="性状"
              :show-overflow-tooltip="true"
              min-width="100px"
            >
              <template slot-scope="scope">
                {{
                  scope.row.propertyTwo == "" ||
                  scope.row.propertyTwo == undefined
                    ? "---"
                    : scope.row.propertyTwo
                }}
              </template>
            </el-table-column> -->
            <el-table-column
              property="status"
              label="状态"
              :formatter="formatterStatus"
              min-width="90px"
              key="status1"
            >
              <template slot-scope="scope">
                <span v-if="scope.row.status == 0">待审核</span>
                <span v-else-if="scope.row.status == 1">已通过</span>
                <span v-else>已驳回</span>
              </template>
            </el-table-column>
            <el-table-column
              property="applyName"
              label="申请人"
              min-width="90px"
              key="applyName1"
            >
            </el-table-column>
            <el-table-column
              property="chekName"
              label="审批人"
              min-width="90px"
              key="chekName1"
            >
            </el-table-column>
            <!-- <el-table-column
              property="reason"
              label="变更原因"
              min-width="90px"
              key="reason"
            >
            </el-table-column> -->
            <el-table-column
              property="applyDate"
              label="申请时间"
              min-width="145px"
              key="applyDate"
            >
            </el-table-column>
            <el-table-column
              label="操作"
              :key="Math.random()"
              min-width="100px"
            >
              <template slot-scope="scope">
                <el-button
                  v-if="
                    changeQuery.status == 0 &&
                    scope.row.chekBy.toLowerCase() == userInfo.loginid.toLowerCase()
                  "
                  type="text"
                  size="mini"
                  @click="passOrRejected(scope.row, 1)"
                  >审批</el-button
                >
                <el-button
                  type="text"
                  size="mini"
                  v-if="changeQuery.status == '2'"
                  @click="editRows(scope.row)"
                  >编辑</el-button
                >
                <el-button
                  type="text"
                  size="mini"
                  @click="passOrRejected(scope.row, 0)"
                  >详情</el-button
                >
              </template>
            </el-table-column>
          </el-table>
          <div class="block changepages">
            <el-pagination
              @size-change="handleSizeChange"
              @current-change="handleCurrentChange"
              :current-page="sampleQuery.page"
              :page-sizes="[20, 50, 100, 500, 1000]"
              :page-size="sampleQuery.pageCount"
              layout="total, sizes, prev, pager, next, jumper"
              :total="rowNumber"
            >
            </el-pagination>
          </div>
        </div>
      </div>
    </div>
    <div class="samplereceptionDialog" v-if="acceptDetailShow">
      <div class="twoStageWindow">
        <div class="twoStageWindowTitle">
          样品接收

          <span style="color: green; width: 100px; display: inline-block">
            {{ currentSample + 1 }}/{{ multipleSelection.length }}
          </span>

          <div class="twoStageWindowClose">
            <el-button
              v-if="currentSample > 0 && isAccept"
              size="mini"
              @click="changeSampleNum('reduce')"
              >上一个</el-button
            >
            <el-button
              v-if="currentSample < samplenum - 1 && isAccept"
              size="mini"
              @click="changeSampleNum('add')"
              >下一个</el-button
            >
            <el-tooltip
              content="该样品暂时被标记为'已作废',点击'全部接收'后生效"
              effect="dark"
              placement="bottom-start"
            >
              <el-button
                type="primary"
                size="mini"
                @click="invalidSample"
                v-if="isAccept"
                >样品作废</el-button
              >
            </el-tooltip>

            <!--是接受样品并且是最后一个样品时显示接收按钮 && currentSample == samplenum - 1-->
            <el-button
              size="mini"
              type="primary"
              @click="subAccept"
              v-if="isAccept"
              :disabled="!isRepeat"
              >全部接收</el-button
            >
            <el-button size="mini" @click="backList()" v-if="showBack"
              >返回列表</el-button
            >
            <el-button size="mini" v-if="showBack" @click="acceptDisShow"
              >取消</el-button
            >
            <el-button size="mini" v-if="!showBack" @click="close"
              >取消</el-button
            >
          </div>
        </div>
        <div
          class="containercontent"
          style="margin-top: 40px; height: calc(100% - 40px); padding-top: 0"
        >
          <el-form
            label-width="110px"
            :inline="false"
            class="demo-form-inline form"
            :model="sampleAcceptForm"
            ref="sampleAcceptForm"
          >
            <el-form-item label="样品名称" prop="name">
              <el-col :span="22">
                <el-input
                  size="mini"
                  v-model="sampleAcceptForm.name"
                  disabled
                ></el-input>
              </el-col>
            </el-form-item>
            <el-form-item label="样品编号" prop="code">
              <el-col :span="22">
                <el-input
                  size="mini"
                  v-model="sampleAcceptForm.code"
                  disabled
                ></el-input>
              </el-col>
            </el-form-item>
            <el-form-item label="采样人" prop="factManName">
              <el-col :span="22">
                <el-input
                  size="mini"
                  placeholder="展示默认采样人"
                  v-model="sampleAcceptForm.factManName"
                  disabled
                ></el-input>
              </el-col>
            </el-form-item>
            <el-form-item label="采样日期" prop="factDate">
              <el-col :span="22">
                <el-date-picker
                  v-model="sampleAcceptForm.factDate"
                  type="datetime"
                  size="mini"
                  style="width: 100%"
                  format="yyyy-MM-dd HH:mm:ss"
                  value-format="yyyy-MM-dd HH:mm:ss"
                  placeholder="选择日期"
                  :clearable="false"
                >
                </el-date-picker>
              </el-col>
            </el-form-item>
            <el-form-item label="接收人" prop="acceptManName">
              <el-col :span="22">
                <el-select
                  v-model="sampleAcceptForm.acceptManName"
                  size="mini"
                  filterable
                  remote
                  :remote-method="readUser"
                  value-key="account"
                  style="width: 100%"
                  :disabled="true"
                >
                  <el-option
                    v-for="item in userData"
                    :key="item.account"
                    :label="item.name"
                    :value="item"
                    :disabled="item.disabled"
                  >
                  </el-option>
                </el-select>
              </el-col>
            </el-form-item>
            <el-form-item label="接收时间" prop="acceptDate">
              <el-col :span="22">
                <el-date-picker
                  v-model="sampleAcceptForm.acceptDate"
                  type="datetime"
                  size="mini"
                  style="width: 100%"
                  :picker-options="pickerenddatefanwei"
                  :disabled="!isAccept"
                  placeholder="选择日期"
                  format="yyyy-MM-dd HH:mm:ss"
                  value-format="yyyy-MM-dd HH:mm:ss"
                  :clearable="false"
                >
                </el-date-picker>
              </el-col>
            </el-form-item>
            <el-form-item label="样品性状" prop="propertyTwo">
              <el-col :span="22">
                <el-input
                  size="mini"
                  placeholder="展示样品性状"
                  v-model="sampleAcceptForm.propertyTwo"
                  :disabled="true"
                ></el-input>
              </el-col>
            </el-form-item>
            <el-form-item label="样品状态" prop="status" v-if="reload">
              <el-col :span="22">
                <el-select
                  v-model="sampleAcceptForm.status"
                  placeholder="请选择"
                  size="mini"
                  disabled
                  style="width: 100%"
                  :class="{ feiqiRed: sampleAcceptForm.status == 512 }"
                >
                  <el-option
                    v-for="item in taskSampleStatus"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-col>
            </el-form-item>
          </el-form>
          <div class="selectw100 addbottle" v-if="isAccept">
            <el-button type="primary" size="mini" @click="addbottletype"
              >添加</el-button
            >
            <!--【多选时这里默认显示第一个勾选样品设置的采样瓶类型及数量，且可以编辑】-->
          </div>
          <div class="penalrow selectw100">
            <el-table
              ref="sampleBottle"
              :data="sampleAcceptForm.sampleDetailBeans"
              style="width: 100%"
              size="mini"
              height="100%"
            >
              <!--<el-table-column property="doHas" min-width="70px">
                <template slot-scope="scope">
                  <el-checkbox v-model="scope.row.doHas" @change="checkboxChange($event,scope.row)" :disabled="!isAccept"></el-checkbox>
                </template>
              </el-table-column>-->
              <el-table-column
                property="bottleType"
                label="容器材质"
                min-width="110px"
              >
                <template slot-scope="scope">
                  <el-select
                    v-model="scope.row.bottleType"
                    placeholder="请选择"
                    size="mini"
                    :disabled="
                      !scope.row.doHas || scope.row.doMust || !isAccept
                    "
                  >
                    <el-option
                      v-for="item in bottleOptions"
                      :key="item.id"
                      :label="item.name"
                      :value="item.id"
                    >
                    </el-option>
                  </el-select>
                </template>
              </el-table-column>
              <el-table-column
                property="capacity"
                label="容器容量(mL)"
                min-width="100px"
              >
                <template slot-scope="scope">
                  <el-input
                    v-model="scope.row.capacity"
                    oninput="this.value=this.value.replace(/[^0-9]+/,'');"
                    size="mini"
                    :disabled="
                      !scope.row.doHas || scope.row.doMust || !isAccept
                    "
                    class="deal"
                  ></el-input>
                  <!--<el-select v-model="scope.row.capacity" placeholder="请选择" size="mini" :disabled="!scope.row.doHas || scope.row.doMust || !isAccept">
                        <el-option
                          v-for="item in rongqirongliang"
                          :key="item.value"
                          :label="item.label"
                          :value="item.value">
                        </el-option>
                    </el-select>-->
                </template>
              </el-table-column>
              <el-table-column
                property="number"
                label="容器数量"
                min-width="100px"
              >
                <template slot-scope="scope">
                  <el-input
                    v-model="scope.row.number"
                    oninput="this.value=this.value.replace(/[^0-9]+/,'');"
                    size="mini"
                    class="deal"
                    :min="1"
                    :disabled="!scope.row.doHas || !isAccept"
                  ></el-input>
                </template>
              </el-table-column>
              <el-table-column
                property="doCopy"
                label="是否留样"
                min-width="70px"
              >
                <template slot-scope="scope">
                  <el-checkbox
                    v-model="scope.row.doCopy"
                    :disabled="!scope.row.doHas || !isAccept"
                    @change="checkDoCopy($event, scope.row)"
                  ></el-checkbox>
                </template>
              </el-table-column>
              <!--              <el-table-column property="address" label="留样位置" min-width="200px">-->
              <!--                <template slot-scope="scope">-->
              <!--                  <el-autocomplete class="inline-input" size="mini" v-model="scope.row.address" :fetch-suggestions="querySearch"  placeholder="留样位置" :disabled="!scope.row.doHas || !scope.row.doCopy || !isAccept">-->
              <!--                  </el-autocomplete>-->
              <!--                  &lt;!&ndash;<el-input v-model="scope.row.address" size="mini" placeholder="留样位置" :disabled="!scope.row.doHas || !scope.row.doCopy || !isAccept"></el-input>&ndash;&gt;-->
              <!--                </template>-->
              <!--              </el-table-column>-->
              <el-table-column
                property="doCopyTwo"
                label="是否残样"
                min-width="70px"
              >
                <template slot-scope="scope">
                  <el-checkbox
                    v-model="scope.row.doCopyTwo"
                    :disabled="!scope.row.doHas || !isAccept"
                    @change="checkDoCopyTwo($event, scope.row)"
                  ></el-checkbox>
                </template>
              </el-table-column>
              <!--              <el-table-column property="addressTwo" label="残样位置" min-width="200px">-->
              <!--                <template slot-scope="scope">-->
              <!--                  <el-autocomplete class="inline-input" size="mini" v-model="scope.row.addressTwo" :fetch-suggestions="querySearch"  placeholder="留样位置" :disabled="!scope.row.doHas || !scope.row.doCopyTwo || !isAccept">-->
              <!--                  </el-autocomplete>-->
              <!--                  &lt;!&ndash;<el-input v-model="scope.row.address" size="mini" placeholder="留样位置" :disabled="!scope.row.doHas || !scope.row.doCopy || !isAccept"></el-input>&ndash;&gt;-->
              <!--                </template>-->
              <!--              </el-table-column>-->
              <el-table-column
                property="saveTime"
                label="保存时间(h)"
                min-width="100px"
              >
                <template slot-scope="scope">
                  <el-input
                    v-model="scope.row.saveTime"
                    size="mini"
                    placeholder="保存时间"
                    :disabled="scope.row.md != undefined"
                  ></el-input>
                </template>
              </el-table-column>
              <el-table-column
                property="media"
                label="保存剂"
                min-width="100px"
              >
                <template slot-scope="scope">
                  <el-input
                    v-model="scope.row.media"
                    size="mini"
                    placeholder="保存剂"
                    :disabled="scope.row.md != undefined"
                  ></el-input>
                </template>
              </el-table-column>
              <el-table-column label="操作" v-if="isAccept" min-width="100px">
                <template slot-scope="scope">
                  <el-button
                    type="text"
                    size="mini"
                    @click="deletebottle(scope.$index)"
                    >删除</el-button
                  >
                </template>
              </el-table-column>
            </el-table>
          </div>
        </div>
      </div>
    </div>
    <div class="samplereceptionDialog" v-if="destroyDetailShow">
      <div class="twoStageWindow">
        <div class="twoStageWindowTitle">
          样品销毁

          <span style="color: green; width: 100px; display: inline-block">
            {{ currentSample + 1 }}/{{ multipleSelection.length }}
          </span>

          <div class="twoStageWindowClose">
            <el-button
              v-if="currentSample > 0 && isAccept"
              size="mini"
              @click="changeSampleNum('reduce')"
              >上一个</el-button
            >
            <el-button
              v-if="currentSample < samplenum - 1 && isDestroy"
              size="mini"
              @click="changeSampleNum('add')"
              >下一个</el-button
            >
            <!--            <el-tooltip content = "该样品暂时被标记为'已作废',点击'全部接收'后生效"  effect="dark" placement="bottom-start">-->
            <!--                <el-button type="primary" size="mini" @click="invalidSample" v-if="isAccept">样品作废</el-button>-->
            <!--            </el-tooltip>-->

            <!--是接受样品并且是最后一个样品时显示接收按钮 && currentSample == samplenum - 1-->
            <el-button
              size="mini"
              type="primary"
              @click="subDestroy"
              v-if="isDestroy"
              :disabled="!isRepeat"
              >全部销毁</el-button
            >

            <el-button size="mini" @click="closeDestroy">取消</el-button>
          </div>
        </div>
        <div
          class="containercontent"
          style="margin-top: 40px; height: calc(100% - 40px); padding-top: 0"
        >
          <el-form
            label-width="110px"
            :inline="false"
            class="demo-form-inline form"
            :model="sampleAcceptForm"
            ref="sampleAcceptForm"
          >
            <el-form-item label="样品名称" prop="name">
              <el-col :span="22">
                <el-input
                  size="mini"
                  v-model="sampleAcceptForm.name"
                  disabled
                ></el-input>
              </el-col>
            </el-form-item>
            <el-form-item label="样品编号" prop="code">
              <el-col :span="22">
                <el-input
                  size="mini"
                  v-model="sampleAcceptForm.code"
                  disabled
                ></el-input>
              </el-col>
            </el-form-item>
            <!--            <el-form-item label="采样人" prop="factManName">-->
            <!--              <el-col :span="22">-->
            <!--                <el-input size="mini" placeholder="展示默认采样人" v-model="sampleAcceptForm.factManName" disabled></el-input>-->
            <!--              </el-col>-->
            <!--            </el-form-item>-->
            <!--            <el-form-item label="采样日期" prop="factDate">-->
            <!--              <el-col :span="22">-->
            <!--                <el-date-picker v-model="sampleAcceptForm.factDate" type="datetime" size="mini" style="width:100%;" format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss"-->
            <!--                  placeholder="选择日期" :clearable="false">-->
            <!--                </el-date-picker>-->
            <!--              </el-col>-->
            <!--            </el-form-item>-->
            <!--            <el-form-item label="接收人" prop="acceptManName">-->
            <!--              <el-col :span="22">-->
            <!--                <el-select v-model="sampleAcceptForm.acceptManName" size="mini" filterable remote :remote-method="readUser" value-key="account"-->
            <!--                  style="width:100%;" :disabled="!isAccept">-->
            <!--                  <el-option v-for="item in userData" :key="item.account" :label="item.name" :value="item" :disabled="item.disabled">-->
            <!--                  </el-option>-->
            <!--                </el-select>-->
            <!--              </el-col>-->
            <!--            </el-form-item>-->
            <!--            <el-form-item label="接收时间" prop="acceptDate">-->
            <!--              <el-col :span="22">-->
            <!--                <el-date-picker v-model="sampleAcceptForm.acceptDate" type="datetime" size="mini" style="width:100%;" :picker-options="pickerenddatefanwei"-->
            <!--                  :disabled="!isAccept" placeholder="选择日期" format ="yyyy-MM-dd HH:mm:ss" value-format ="yyyy-MM-dd HH:mm:ss" :clearable="false">-->
            <!--                </el-date-picker>-->
            <!--              </el-col>-->
            <!--            </el-form-item>-->
            <el-form-item label="样品性状" prop="propertyTwo">
              <el-col :span="22">
                <el-input
                  size="mini"
                  placeholder="展示样品性状"
                  v-model="sampleAcceptForm.propertyTwo"
                  disabled
                ></el-input>
              </el-col>
            </el-form-item>
            <el-form-item label="样品状态" prop="status" v-if="reload">
              <el-col :span="22">
                <el-select
                  v-model="sampleAcceptForm.status"
                  placeholder="请选择"
                  size="mini"
                  disabled
                  style="width: 100%"
                  :class="{ feiqiRed: sampleAcceptForm.status == 512 }"
                >
                  <el-option
                    v-for="item in taskSampleStatus"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-col>
            </el-form-item>
          </el-form>
          <div class="selectw100 addbottle" v-if="isDestroy">
            <el-button type="primary" size="mini" @click="addbottletypeTwo"
              >添加</el-button
            >
            <!--【多选时这里默认显示第一个勾选样品设置的采样瓶类型及数量，且可以编辑】-->
          </div>
          <div class="penalrow selectw100">
            <el-table
              ref="sampleBottle"
              :data="sampleAcceptForm.sampleDetailBeans"
              style="width: 100%"
              size="mini"
              height="100%"
            >
              <el-table-column property="doHas" min-width="70px">
                <template slot-scope="scope">
                  <el-checkbox
                    v-model="scope.row.doHas"
                    v-show="scope.row.doCopyTwo"
                    @change="checkboxChangeTwo($event, scope.row)"
                    :disabled="!isDestroy"
                  ></el-checkbox>
                </template>
              </el-table-column>
              <el-table-column
                property="bottleType"
                label="容器材质"
                min-width="110px"
              >
                <template slot-scope="scope">
                  <el-select
                    v-model="scope.row.bottleType"
                    placeholder="请选择"
                    size="mini"
                  >
                    <el-option
                      v-for="item in bottleOptions"
                      :key="item.id"
                      :label="item.name"
                      :value="item.id"
                    >
                    </el-option>
                  </el-select>
                </template>
              </el-table-column>
              <el-table-column
                property="destroyDate"
                label="销毁时间"
                min-width="200px"
              >
                <template slot-scope="scope">
                  <el-date-picker
                    v-model="scope.row.destroyDate"
                    type="date"
                    size="mini"
                    value-format="yyyy-MM-dd"
                    style="width: 100%"
                    placeholder="选择日期"
                  >
                  </el-date-picker>
                </template>
              </el-table-column>
              <el-table-column
                property="destroyName"
                label="销毁人"
                min-width="200px"
              >
                <template slot-scope="scope">
                  <el-select
                    v-model="scope.row.destroyName"
                    size="mini"
                    filterable
                    remote
                    :remote-method="readUser"
                    value-key="account"
                    style="width: 100%"
                    :disabled="!isAccept"
                  >
                    <el-option
                      v-for="item in userData"
                      :key="item.account"
                      :label="item.name"
                      :value="item"
                      :disabled="item.disabled"
                    >
                    </el-option>
                  </el-select>
                </template>
              </el-table-column>
              <el-table-column
                property="destroyWay"
                label="销毁方式"
                min-width="200px"
              >
                <template slot-scope="scope">
                  <!--                  <el-autocomplete class="inline-input" size="mini" v-model="scope.row.destroyWay" :fetch-suggestions="querySearch"  placeholder="留样位置" :disabled="!scope.row.doHas || !scope.row.doCopy || !isAccept">-->
                  <!--                  </el-autocomplete>-->
                  <el-input
                    v-model="scope.row.destroyWay"
                    size="mini"
                    placeholder="销毁方式"
                  ></el-input>
                </template>
              </el-table-column>
              <el-table-column
                property="doCopyTwo"
                label="是否留样"
                min-width="70px"
              >
                <template slot-scope="scope">
                  <el-checkbox
                    v-model="scope.row.doCopyTwo"
                    :disabled="!isDestroy"
                    @change="checkBox($event, scope.row)"
                  ></el-checkbox>
                </template>
              </el-table-column>
              <el-table-column
                property="doCopy;"
                label="是否残样"
                min-width="70px"
              >
                <template slot-scope="scope">
                  <el-checkbox
                    v-model="scope.row.doCopy"
                    :disabled="!isDestroy"
                  ></el-checkbox>
                </template>
              </el-table-column>
              <el-table-column
                property="saveTime"
                label="保存时间(h)"
                min-width="100px"
              >
                <template slot-scope="scope">
                  <el-input
                    v-model="scope.row.saveTime"
                    size="mini"
                    placeholder="保存时间"
                    :disabled="scope.row.md != undefined"
                  ></el-input>
                </template>
              </el-table-column>
              <el-table-column
                property="media"
                label="保存剂"
                min-width="100px"
              >
                <template slot-scope="scope">
                  <el-input
                    v-model="scope.row.media"
                    size="mini"
                    placeholder="保存剂"
                    :disabled="scope.row.md != undefined"
                  ></el-input>
                </template>
              </el-table-column>
              <!--              <el-table-column property="address" label="留样位置" min-width="200px">-->
              <!--                <template slot-scope="scope">-->
              <!--                  <el-input v-model="scope.row.address" size="mini" placeholder="留样位置" :disabled="!scope.row.doHas || !scope.row.doCopy || !isAccept"></el-input>-->
              <!--                </template>-->
              <!--              </el-table-column>-->
              <el-table-column label="操作" v-if="isAccept" min-width="100px">
                <template slot-scope="scope">
                  <el-button
                    type="text"
                    size="mini"
                    @click="deletebottle(scope.$index)"
                    >删除</el-button
                  >
                </template>
              </el-table-column>
            </el-table>
          </div>
        </div>
      </div>
    </div>

    <div v-if="jiancebiaoqianShow">
      <jiancebiaoqian></jiancebiaoqian>
    </div>
    <sample-print
      :addVisible.sync="printTableShow"
      :multipleSelection="multipleSelection"
      :acceptOrregist="acceptOrregist"
    ></sample-print>
    <scan-print
      :addVisible.sync="scanTableShow"
      :multipleSelection="multipleSelection"
      :acceptOrregist="acceptOrregist"
    ></scan-print>
    <el-dialog
      :visible.sync="acceptDialog"
      width="94%"
      :show-close="false"
      class="acceptDialog"
      :closeOnClickModal="false"
    >
      <span slot="title" class="dialog-title">
        样品接收
        <el-button size="mini" class="popupClose" @click="acceptDisShow"
          >关闭</el-button
        >
      </span>
      <el-table
        :data="acceptData"
        style="width: 100%; height: 100%"
        class="tableCon"
        size="mini"
        v-if="reload"
      >
        <el-table-column label="序号" type="index" width="50">
        </el-table-column>
        <el-table-column
          property="name"
          label="样品名称"
          min-width="200px"
          show-overflow-tooltip
        >
        </el-table-column>
        <el-table-column property="code" label="样品编号" min-width="200px" :render-header="addRedStar">
          <template slot-scope="scope">
            <el-input
              v-model="scope.row.code"
              size="mini"
              style="width: 150px"
              placeholder="请输入样品编号"
              @focus="mouseoverHH(1, scope.row)"
            ></el-input>
            <el-button
              v-if="scope.row.piluru1"
              type="text"
              size="mini"
              @click="setCode(scope.row, scope.$index, 'code', 1)"
              class="buttonPiluru"
              >批量</el-button
            >
          </template>
        </el-table-column>
        <el-table-column
          property="propertyTwo"
          label="样品性状"
          min-width="200px"
        >
          <template slot-scope="scope">
            <el-input
              @focus="mouseoverHH(2, scope.row)"
              size="mini"
              style="width: 150px"
              v-model="scope.row.propertyTwo"
              placeholder="无色透明"
            ></el-input>
            <el-button
              v-if="scope.row.piluru2"
              type="text"
              size="mini"
              @click="piluru(scope.row, scope.$index, 'propertyTwo', 1)"
              class="buttonPiluru"
              >批量</el-button
            >
          </template>
        </el-table-column>
        <el-table-column
          property="factDate"
          label="采样日期"
          :formatter="formatterDate"
          min-width="230px"
          :render-header="addRedStar"
        >
          <template slot-scope="scope">
            <el-date-picker
              v-model="scope.row.factDate"
              type="datetime"
              size="mini"
              style="width: 180px"
              format="yyyy-MM-dd HH:mm:ss"
              value-format="yyyy-MM-dd HH:mm:ss"
              placeholder="选择时间"
              @focus="mouseoverHH(3, scope.row)"
            >
            </el-date-picker>
            <el-button
              v-if="scope.row.piluru3"
              type="text"
              size="mini"
              @click="piluru(scope.row, scope.$index, 'factDate', 1)"
              class="buttonPiluru"
              >批量</el-button
            >
          </template>
        </el-table-column>
        <el-table-column
          property="factManName"
          label="采样人"
          min-width="70px"
          show-overflow-tooltip
        >
        </el-table-column>
        <el-table-column property="acceptManName" label="接收人" width="70px">
        </el-table-column>
        <el-table-column
          property="acceptDate"
          label="接收时间"
          :formatter="formatterDate"
          min-width="230px"
          :render-header="addRedStar"
        >
          <template slot-scope="scope">
            <el-date-picker
              v-model="scope.row.acceptDate"
              type="datetime"
              size="mini"
              style="width: 180px"
              format="yyyy-MM-dd HH:mm:ss"
              value-format="yyyy-MM-dd HH:mm:ss"
              placeholder="选择时间"
              :picker-options="pickerenddatefanwei"
              @focus="mouseoverHH(5, scope.row)"
            >
            </el-date-picker>
            <el-button
              v-if="scope.row.piluru5"
              type="text"
              size="mini"
              @click="piluru(scope.row, scope.$index, 'acceptDate', 1)"
              class="buttonPiluru"
              >批量</el-button
            >
          </template>
        </el-table-column>
        <el-table-column label="操作" width="70">
          <template slot-scope="scope">
            <i
              v-if="scope.$index"
              @click="shiftRow(scope.$index, 'UP')"
              class="el-icon-upload2 btn-hover"
              style="font-size: 16px; color: #409eff"
            ></i>
            <i
              v-if="scope.$index + 1 != acceptData.length"
              @click="shiftRow(scope.$index, 'DOWN')"
              class="el-icon-download btn-hover"
              style="font-size: 16px; color: #409eff"
            ></i>
            <!-- <el-button
              v-if="scope.$index"
              @click="shiftRow(scope.$index, 'UP')"
              type="text"
              size="small"
              icon="el-icon-top"
              >上移</el-button
            >
            <el-button
              v-if="scope.$index + 1 != acceptData.length"
              @click="shiftRow(scope.$index, 'DOWN')"
              type="text"
              size="small"
              icon="el-icon-bottom"
              >下移</el-button
            > -->
          </template>
        </el-table-column>
      </el-table>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="toAccept" size="mini">继续</el-button>
        <el-button size="mini" @click="acceptDisShow">取 消</el-button>
      </span>
    </el-dialog>

    <el-dialog
      :visible.sync="changeDialog"
      width="94%"
      :show-close="false"
      class="acceptDialog"
      :closeOnClickModal="false"
    >
      <span slot="title" class="dialog-title">
        样品变更
        <el-button size="mini" class="popupClose" @click="closeChange"
          >关闭</el-button
        >
      </span>
      <el-table
        :data="changeData"
        style="width: 100%; height: 100%"
        class="tableCon"
        size="mini"
        v-if="reload"
      >
        <el-table-column label="序号" type="index" width="50">
        </el-table-column>
        <el-table-column
          property="sampleName"
          label="样品名称"
          min-width="176px"
        >
          <!-- <template slot-scope="scope">
            <el-input
              v-model="scope.row.sampleName"
              size="mini"
              style="width: 162px"
              placeholder="请输入样品名称"
            ></el-input>
          </template> -->
        </el-table-column>
        <el-table-column property="newCode" label="样品编号" min-width="176px" :render-header="addRedStar">
          <template slot-scope="scope">
            <el-input
              v-model="scope.row.newCode"
              size="mini"
              style="width: 126px"
              placeholder="请输入样品编号"
              @focus="mouseoverHH(6, scope.row)"
            ></el-input>
            <el-button
              v-if="scope.row.piluru6"
              type="text"
              size="mini"
              @click="setCode(scope.row, scope.$index, 'newCode')"
              class="buttonPiluru"
              >批量</el-button
            >
          </template>
        </el-table-column>
        <!-- <el-table-column
          property="factManName"
          label="采样人"
          min-width="150px"
          show-overflow-tooltip
        >
          <template slot-scope="scope">
            <el-select
              v-model="scope.row.factManName"
              style="width: 90px"
              size="mini"
              filterable
              remote
              :remote-method="readUser"
              value-key="account"
              @focus="mouseoverHH(7, scope.row)"
            >
              <el-option
                v-for="item in userData"
                :key="item.account"
                :label="item.name"
                :value="item"
                :disabled="item.disabled"
              >
              </el-option>
            </el-select>
            <el-button
              v-if="scope.row.piluru7"
              type="text"
              size="mini"
              @click="piluru(scope.row, scope.$index, 'factManName')"
              class="buttonPiluru"
              >批量</el-button
            >
          </template>
        </el-table-column> -->
        <el-table-column
          property="factDate"
          label="采样日期"
          :formatter="formatterDate"
          min-width="224px"
          :render-header="addRedStar"
        >
          <template slot-scope="scope">
            <el-date-picker
              v-model="scope.row.factDate"
              type="datetime"
              size="mini"
              style="width: 174px"
              format="yyyy-MM-dd HH:mm:ss"
              value-format="yyyy-MM-dd HH:mm:ss"
              placeholder="选择时间"
              @focus="mouseoverHH(8, scope.row)"
            >
            </el-date-picker>
            <el-button
              v-if="scope.row.piluru8"
              type="text"
              size="mini"
              @click="piluru(scope.row, scope.$index, 'factDate')"
              class="buttonPiluru"
              >批量</el-button
            >
          </template>
        </el-table-column>
        <!-- <el-table-column property="acceptManName" label="接收人" width="150px">
          <template slot-scope="scope">
            <el-select
              v-model="scope.row.acceptManName"
              style="width: 90px"
              size="mini"
              filterable
              remote
              :remote-method="readUser"
              value-key="account"
              @focus="mouseoverHH(9, scope.row)"
            >
              <el-option
                v-for="item in userData"
                :key="item.account"
                :label="item.name"
                :value="item"
                :disabled="item.disabled"
              >
              </el-option>
            </el-select>
            <el-button
              v-if="scope.row.piluru9"
              type="text"
              size="mini"
              @click="piluru(scope.row, scope.$index, 'acceptManName')"
              class="buttonPiluru"
              >批量</el-button
            >
          </template>
        </el-table-column> -->
        <el-table-column
          property="acceptDate"
          label="接收时间"
          :formatter="formatterDate"
          min-width="224px"
          :render-header="addRedStar"
        >
          <template slot-scope="scope">
            <el-date-picker
              v-model="scope.row.acceptDate"
              type="datetime"
              size="mini"
              style="width: 174px"
              format="yyyy-MM-dd HH:mm:ss"
              value-format="yyyy-MM-dd HH:mm:ss"
              placeholder="选择时间"
              :picker-options="pickerenddatefanwei"
              @focus="mouseoverHH(10, scope.row)"
            >
            </el-date-picker>
            <el-button
              v-if="scope.row.piluru10"
              type="text"
              size="mini"
              @click="piluru(scope.row, scope.$index, 'acceptDate')"
              class="buttonPiluru"
              >批量</el-button
            >
          </template>
        </el-table-column>
        <el-table-column
          property="propertyTwo"
          label="样品性状"
          min-width="150px"
        >
          <template slot-scope="scope">
            <el-input
              @focus="mouseoverHH(11, scope.row)"
              size="mini"
              style="width: 100px"
              v-model="scope.row.propertyTwo"
              placeholder="无色透明"
            ></el-input>
            <el-button
              v-if="scope.row.piluru11"
              type="text"
              size="mini"
              @click="piluru(scope.row, scope.$index, 'propertyTwo')"
              class="buttonPiluru"
              >批量</el-button
            >
          </template>
        </el-table-column>
        <!-- <el-table-column
          property="status"
          label="样品状态"
          :formatter="formatterStatus"
          min-width="70px"
          show-overflow-tooltip
        >
        </el-table-column>
        <el-table-column
          property="applicant"
          label="申请人"
          min-width="70px"
          show-overflow-tooltip
        >
        </el-table-column> -->
        <el-table-column property="chekName" label="审批人" width="140px" :render-header="addRedStar">
          <template slot-scope="scope">
            <el-select
              v-model="scope.row.chekName"
              style="width: 90px"
              size="mini"
              filterable
              remote
              :remote-method="readUser"
              value-key="account"
              @focus="mouseoverHH(12, scope.row)"
            >
              <el-option
                v-for="item in checkData"
                :key="item.account"
                :label="item.name"
                :value="item"
                :disabled="item.disabled"
              >
              </el-option>
            </el-select>
            <el-button
              v-if="scope.row.piluru12"
              type="text"
              size="mini"
              @click="piluru(scope.row, scope.$index, 'chekName')"
              class="buttonPiluru"
              >批量</el-button
            >
          </template>
        </el-table-column>
        <el-table-column property="reason" label="变更原因" min-width="165px" :render-header="addRedStar">
          <template slot-scope="scope">
            <el-input
              @focus="mouseoverHH(13, scope.row)"
              size="mini"
              style="width: 115px"
              v-model="scope.row.reason"
              placeholder="请输入变更原因"
            ></el-input>
            <el-button
              v-if="scope.row.piluru13"
              type="text"
              size="mini"
              @click="piluru(scope.row, scope.$index, 'reason')"
              class="buttonPiluru"
              >批量</el-button
            >
          </template>
        </el-table-column>
        <el-table-column property="reason1" label="" min-width="24px">
        </el-table-column>
        
      </el-table>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="toChangeInfo" size="mini"
          >提交</el-button
        >
        <el-button size="mini" @click="closeChange">取 消</el-button>
      </span>
    </el-dialog>
    <el-dialog
      :visible.sync="passOrRejectDialog"
      width="90%"
      :show-close="false"
      class="passOrRejectDialog"
      :closeOnClickModal="false"
    >
      <span slot="title" class="dialog-title">
        变更审核
        <el-button
          size="mini"
          class="popupClose"
          @click="passOrRejectDialog = false"
          >关闭</el-button
        >
      </span>
      <div class="content">
        <div class="content-flex">
          <div class="twoTitle">样品变更前</div>
          <el-form
            label-width="110px"
            :inline="false"
            class="demo-form-inline form"
            :model="passOrRejectData"
            ref="passOrRejectData"
          >
            <el-row>
              <el-col :span="6">
                <el-form-item label="样品名称" prop="sampleName">
                  <el-input
                    size="mini"
                    v-model="passOrRejectData.sampleName"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="样品编号" prop="oldCode">
                  <el-input
                    size="mini"
                    v-model="passOrRejectData.oldCode"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="采样时间" prop="oldFactDate">
                  <el-input
                    size="mini"
                    v-model="passOrRejectData.oldFactDate"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="性状" prop="oldPropertyTwo">
                  <el-input
                    size="mini"
                    v-model="passOrRejectData.oldPropertyTwo"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <!-- <el-col :span="6">
                <el-form-item label="采样人" prop="oldFactManName">
                  <el-input
                    size="mini"
                    v-model="passOrRejectData.oldFactManName"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="接收人" prop="oldAcceptManName">
                  <el-input
                    size="mini"
                    v-model="passOrRejectData.oldAcceptManName"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col> -->
              <el-col :span="6">
                <el-form-item label="接收时间" prop="oldAcceptDate">
                  <el-input
                    size="mini"
                    v-model="passOrRejectData.oldAcceptDate"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
        </div>
        <div class="content-flex no-top">
          <div class="twoTitle">样品变更后</div>
          <el-form
            label-width="110px"
            :inline="false"
            class="demo-form-inline form"
            :model="passOrRejectData"
            ref="passOrRejectData"
          >
            <el-row>
              <el-col :span="6">
                <el-form-item label="样品名称" prop="sampleName">
                  <el-input
                    size="mini"
                    v-model="passOrRejectData.sampleName"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="样品编号" prop="newCode">
                  <el-input
                    :class="{
                      redText:
                        passOrRejectData.oldCode != passOrRejectData.newCode,
                    }"
                    size="mini"
                    v-model="passOrRejectData.newCode"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="采样时间" prop="factDate">
                  <el-input
                    :class="{
                      redText:
                        passOrRejectData.oldFactDate !=
                        passOrRejectData.factDate,
                    }"
                    size="mini"
                    v-model="passOrRejectData.factDate"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="性状" prop="propertyTwo">
                  <el-input
                    :class="{
                      redText:
                        passOrRejectData.oldPropertyTwo !=
                        passOrRejectData.propertyTwo,
                    }"
                    size="mini"
                    v-model="passOrRejectData.propertyTwo"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <!-- <el-col :span="6">
                <el-form-item label="采样人" prop="factManName">
                  <el-input
                    :class="{
                      redText:
                        passOrRejectData.oldFactManName !=
                        passOrRejectData.factManName,
                    }"
                    size="mini"
                    v-model="passOrRejectData.factManName"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="接收人" prop="acceptManName">
                  <el-input
                    :class="{
                      redText:
                        passOrRejectData.oldAcceptManName !=
                        passOrRejectData.acceptManName,
                    }"
                    size="mini"
                    v-model="passOrRejectData.acceptManName"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col> -->
              <el-col :span="6">
                <el-form-item label="接收时间" prop="acceptDate">
                  <el-input
                    :class="{
                      redText:
                        passOrRejectData.oldAcceptDate !=
                        passOrRejectData.acceptDate,
                    }"
                    size="mini"
                    v-model="passOrRejectData.acceptDate"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
        </div>
        <div class="content-flex no-top">
          <div class="twoTitle">变更信息</div>
          <el-form
            label-width="110px"
            :inline="false"
            class="demo-form-inline form"
            :model="passOrRejectData"
            ref="passOrRejectData"
          >
            <el-row>
              <el-col :span="6">
                <el-form-item label="申请人" prop="applyName">
                  <el-input
                    size="mini"
                    v-model="passOrRejectData.applyName"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="申请时间" prop="applyDate">
                  <el-input
                    size="mini"
                    v-model="passOrRejectData.applyDate"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <el-form-item label="申请原因" prop="reason">
                  <el-input
                    type="textarea"
                    size="mini"
                    v-model="passOrRejectData.reason"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
        </div>
        <div
          class="content-flex no-top"
          v-if="passOrRejectInfo.type == 1 && changeQuery.status == 0"
        >
          <div class="twoTitle">审核信息</div>
          <el-form
            v-if="passOrRejectInfo.type == 1 && changeQuery.status == 0"
            label-width="110px"
            :inline="false"
            class="demo-form-inline form"
            :model="passOrRejectInfo"
            ref="passOrRejectInfo"
          >
            <el-row>
              <el-col :span="24">
                <el-form-item label="审核" prop="pass">
                  <template>
                    <el-radio v-model="passOrRejectInfo.pass" label="1"
                      >通过</el-radio
                    >
                    <el-radio v-model="passOrRejectInfo.pass" label="2"
                      >驳回</el-radio
                    >
                  </template>
                </el-form-item>
              </el-col>
              <el-col :span="24" v-if="passOrRejectInfo.pass == '2'">
                <el-form-item label="驳回原因" prop="rejectReason">
                  <el-input
                    size="mini"
                    v-model="passOrRejectInfo.rejectReason"
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
        </div>
        <div class="content-flex no-top" v-if="changeQuery.status == 2">
          <div class="twoTitle">审核信息</div>
          <el-form
            v-if="changeQuery.status == 2"
            label-width="110px"
            :inline="false"
            class="demo-form-inline form"
            :model="passOrRejectData"
            ref="passOrRejectInfo"
          >
            <el-row>
              <el-col :span="24">
                <el-form-item label="驳回原因" prop="rejectReason">
                  <el-input
                    size="mini"
                    v-model="passOrRejectData.rejectReason"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
        </div>
      </div>
      <span
        slot="footer"
        class="dialog-footer"
        v-if="passOrRejectInfo.type == 1"
      >
        <el-button type="primary" @click="toPassOrReject" size="mini"
          >提交</el-button
        >
        <el-button size="mini" @click="passOrRejectDialog = false"
          >取 消</el-button
        >
      </span>
    </el-dialog>
    <el-dialog
      :visible.sync="editSampleShow"
      width="88%"
      :show-close="false"
      class="acceptDialog addSampleForm"
      :closeOnClickModal="false"
    >
      <span slot="title" class="dialog-title">
        样品变更
        <el-button size="mini" class="popupClose" @click="editSampleShow = false"
          >关闭</el-button
        >
      </span>
      <div class="containercontent">
      <div>
        <el-form label-width="110px" :inline="false" class="demo-form-inline form" :model="sampleInfo" ref="sampleInfo">
          <el-form-item label="样品名称" prop="sampleName">
            <el-col :span="22">
              <el-input size="mini" v-model="sampleInfo.sampleName" disabled></el-input>
            </el-col>
          </el-form-item>
          <el-form-item label="样品编号" prop="newCode">
            <el-col :span="22">
              <el-input size="mini" v-model="sampleInfo.newCode"></el-input>
            </el-col>
          </el-form-item>
          <el-form-item label="采样日期" prop="factDate">
            <el-col :span="22">
              <el-date-picker v-model="sampleInfo.factDate" type="date" size="mini" style="width:100%;" format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss"
                placeholder="选择日期">
              </el-date-picker>
            </el-col>
          </el-form-item>
          <el-form-item label="接收时间" prop="acceptDate">
            <el-col :span="22">
              <el-date-picker v-model="sampleInfo.acceptDate" type="date" size="mini" style="width:100%;" format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss"
                placeholder="选择日期">
              </el-date-picker>
            </el-col>
          </el-form-item>
          <el-form-item label="样品性状" prop="propertyTwo">
            <el-col :span="22">
              <el-input size="mini" v-model="sampleInfo.propertyTwo"></el-input>
            </el-col>
          </el-form-item>

          <el-form-item label="审批人" prop="chekBy">
            <el-col :span="22">
              <el-select v-model="sampleInfo.chekBy" size="mini" filterable style="width:100%;">
                <el-option v-for="item in userData" :key="item.account" :label="item.name" :value="item.account" :disabled="item.disabled">
                </el-option>
              </el-select>
            </el-col>
          </el-form-item>

          <el-form-item label="变更原因" prop="reason">
            <el-col :span="22">
              <el-input size="mini" v-model="sampleInfo.reason"></el-input>
            </el-col>
          </el-form-item>
        </el-form>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitRow" size="mini"
          >提交</el-button
        >
        <el-button size="mini" @click="editSampleShow = false">取 消</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import { mapState } from "vuex";
import $ from "jquery";
// import { Row } from "_element-ui@2.15.9@element-ui";
const acceptDetail = () => import("./children/acceptDetail.vue");
const jiancebiaoqian = () => import("./children/jiancebiaoqian.vue");
const samplePrint = () => import("./children/samplePrint.vue");
const scanPrint = () => import("./children/scanPrint.vue");

export default {
  data() {
    let that = this;
    return {
      multipleSelections: [],
      editSampleShow: false,
      sampleInfo: {
        "id": "",
        "sampleId": "",
        "sampleName": "",
        "oldCode": "",
        "newCode": "",
        "oldFactDate": "",
        "factDate": "",
        "chekBy": "",
        "chekName": "",
        "chekDate": "",
        "oldAcceptDate": "",
        "acceptDate": "",
        "oldPropertyTwo": "",
        "propertyTwo": "",
        "applyBy": "",
        "applyName": "",
        "applyDate": "",
        "status": 2,
        "reason": ""
      },
      nowTab: "receiveList", //当前显示的页面
      showBack: false, //显示返回列表
      acceptDialog: false, //接收弹框
      acceptData: [],
      changeDialog: false, //申请变更弹框
      changeData: [], //申请变更数据
      changeTableDate: [], //变更列表数据
      // 样品状态
      changeState: [
        {
          code: 0,
          name: "待审核",
        },
        {
          code: 1,
          name: "已通过",
        },
        {
          code: 2,
          name: "已驳回",
        },
      ],
      changeQuery: {
        chekName: "",
        status: 0,
        page: 1,
        pageCount: 20,
      },
      passOrRejectDialog: false, //审批弹框
      passOrRejectInfo: {
        type: 0, //查看详情0审批1
        pass: "1", //通过（1）或驳回（2）
        rejectReason: "", //驳回变更
      }, //审批弹框
      passOrRejectData: {}, //审批弹框
      reload: false,
      taskListValue: "", //任务列表绑定值
      taskList: [], //任务数据
      sampleStateValue: 3, //状态绑定值
      // 样品状态
      sampleState: [
        {
          code: 3,
          name: '待接收'
        },
        {
          code: 4,
          name: '全部'
        },
      ],
      userInfo: {
        loginid: "",
        name: "",
      }, //用户信息
      // collectionMan: JSON.parse(sessionStorage.getItem('laboratoryAccountInfo')).loginid, //采样人绑定值
      collectionMan: "",
      userData: [], //人员数据
      checkData: [], //审批人数据
      sampleTableDate: [], //样品列表数据
      sampleQuery: {
        page: 1,
        pageCount: 20,
      },
      rowNumber: 0, //列表总条数
      acceptDetailShow: false, //接受样品弹框
      destroyDetailShow: false, //销毁样品弹框
      samplenum: 0, //样品数量
      currentSample: 0, //当前显示是第几个样品
      multipleSelection: [], //接收列表勾选的值

      sampleAcceptForm: {
        factManName: "",
        factMan: "",
        propertyOne: "",
        propertyTwo: "",
        factDate: "",
        acceptDate:
          new Date().getFullYear() +
          "-" +
          (new Date().getMonth() + 1) +
          "-" +
          new Date().getDate() +
          " " +
          new Date().getHours() +
          ":" +
          new Date().getMinutes() +
          ":" +
          new Date().getSeconds(),
        // acceptDate: this.util.date() + " " + "00:00:00",
        acceptMan: "",
        acceptManName: "",
      },
      isLoading: true,

      doMust: false, //是否允许删除
      selsBottle: [], //选中的容器数据
      // 样品接收截止日期可选范围
      pickerenddatefanwei: {
        disabledDate: function (time) {
          let timeSpace =
            time.getTime() <
            new Date(
              that.sampleAcceptForm.factDate
                ? that.sampleAcceptForm.factDate
                : "1970-01-01"
            ).getTime() -
              8.64e7;
          return timeSpace;
        },
      },
      // 留样截止日期可选范围
      pickerexpireDate: {
        disabledDate: function (time) {
          let timeSpace =
            time.getTime() <
            new Date(
              that.sampleAcceptForm.acceptDate
                ? that.sampleAcceptForm.acceptDate
                : "1970-01-01"
            ).getTime() -
              8.64e7;
          return timeSpace;
        },
      },
      reload: true, //是否重新加载
      isAccept: true, //是接收还是查看详情
      printTableShow: false, //打印样品标签
      scanTableShow: false, //打印样品标签
      acceptOrregist: "accept", //是样品登记的打印标签还是样品接收的打印标签
      isRepeat: true,
      isDestroy: true,
      selectedAblity: {},

      jiancebiaoqianShow: false,
    };
  },
  props: ["userOpernation"],
  components: {
    acceptDetail,
    jiancebiaoqian,
    samplePrint,
    scanPrint,
  },
  computed: {
    ...mapState(["taskSampleStatus", "bottleOptions", "daibanItemShow"]),
    sampleTypeTable() {
      let that = this;
      return that.$common.objToArr(that.sampleType);
    },
  },
  mounted() {
    this.$store.dispatch("dogetDictionary");
    this.$store.dispatch("getAllBottles");
    this.readUser("");
    this.readTaskSample(this.sampleQuery);
    this.userInfo = JSON.parse(sessionStorage.getItem("laboratoryAccountInfo"));
    if (this.$store.state.nowVal) {
      this.sampleStateValue = this.$store.state.nowVal;
    }
    if (this.$store.state.menuVal) {
      this.$nextTick(() => {
        this.readAllTask();
        this.taskListValue = this.$store.state.menuVal;
        this.readTaskSample(this.sampleQuery, "search");
      });
    }
  },

  watch: {
    sampleQuery: {
      handler(val, oldVal) {
        this.readTaskSample(this.sampleQuery);
      },
      deep: true,
    },
  },
  methods: {
    editRows(row) {
      this.editSampleShow = true;
      this.sampleInfo = JSON.parse(JSON.stringify(row));
    },
    submitRow() {
      for(let i in this.userData){
         if(this.sampleInfo.chekBy == this.userData[i].account){
          this.sampleInfo.chekName = this.userData[i].name;
        }
      }
      this.$http({
        method: "post",
        apiUrl: "/detection/updateChangeSample.htm",
        params: this.sampleInfo,
        isJson: true,
      }).then((res) => {
        if (res.code === 0) {
          this.$message({
            type: "success",
            message: "提交成功!",
          });
          this.editSampleShow = false;
          this.sampleInfo = {};
          this.findChangeList();
        }
      });
    },
    async saveRow(row) {
      let params = {
        id: row.id,
        code: row.code,
        name: row.name,
        fRef: row.fRef,
      };
      let res = await this.$http({
        method: "post",
        apiUrl: "/detection/updateSampleNameOrCode.htm",
        params: params,
        isJson: true,
      });
      if (res.code == 0) {
        this.$notify({
          title: "成功",
          message: "保存成功",
          type: "success",
        });
      } else {
        this.$notify({
          title: "失败",
          message: "保存失败",
          type: "error",
        });
      }
      row.isEdit1 = false;
      this.readTaskSample(this.sampleQuery);
    },
    exportData() {
      // $('.chakanzhuisu').empty()
      let a = this.util.tableToExcel(this.$refs.multipleTable.$el, "123");
      let formdata = new FormData();
      formdata.append("html", `<table>${a}</table> `);
      this.$axios({
        url: "/detection/toExcel.htm",
        method: "post",
        responseType: "blob",
        headers: {
          "Content-type": "multipart/form-data",
          token: sessionStorage.getItem("loginAccount")
            ? sessionStorage.getItem("loginAccount")
            : undefined,
        },
        data: formdata,
      }).then((res) => {
        // $('.chakanzhuisu').html('追溯')
        var name = "样品接收";
        this.util.resultFileBlob(res, name);
      });
    },
    // 留样位置
    querySearch(queryString, cb) {
      this.readStockComList().then((res) => {
        for (var i in res.data) {
          if (res.data[i].status != 0) {
            res.data[i].value = res.data[i].name;
          }
        }
        var restaurants = res.data;
        var results = queryString
          ? restaurants.filter(this.createFilter(queryString))
          : restaurants;
        // 调用 callback 返回建议列表的数据
        cb(results);
      });
    },
    createFilter(queryString) {
      return (restaurant) => {
        return (
          restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) ===
          0
        );
      };
    },
    readStockComList() {
      return new Promise((resolve, reject) => {
        this.$http({
          apiUrl: "/system/readStockComList.htm",
          method: "post",
        }).then((res) => {
          if (res.code === 0) {
            resolve(res);
          }
        });
      });
    },
    // 清空搜索栏
    emptySearch() {
      this.taskListValue = "";
      this.collectionMan = "";
      this.readTaskSample(this.sampleQuery);
    },
    // 处理采样日期
    formatterDate(row, column, cellValue) {
      return this.util.formatterDate({ cellValue: cellValue });
    },
    // 处理样品状态
    formatterStatus(row, column, cellValue, index) {
      return this.util.changeStatus({
        cellValue: cellValue,
        list: this.taskSampleStatus,
      });
    },
    // /readTaskSampleBylab.htm
    //读取采样登记列表
    async readTaskSample(parp, search) {
      this.sampleTableDate = [];
      var params = {
        task: this.taskListValue,
        queryStatus: this.sampleStateValue,
        factMan: this.collectionMan,
      };
      this.isLoading = false;
      if (search != undefined) {
        this.sampleQuery.page = 1;
        params.page = 1;
        params.pageCount = parp.pageCount;
      } else {
        params.page = parp.page;
        params.pageCount = parp.pageCount;
      }
      let res = await this.$http({
        method: "post",
        apiUrl: "/detection/readTaskSampleBylab.htm",
        params: params,
        isJson: true,
      });
      if (res.code === 0) {
        this.isLoading = true;
        for (var i in res.data) {
          // res.data[i].propertyTwo = res.data[i].propertyOne;
          // if (this.sampleStateValue == 4) {
          //   res.data[i].acceptMan = this.userInfo.loginid;
          //   res.data[i].acceptManName = this.userInfo.name;
          // }
          // 给容器列表加doHas属性 如果为true默认选中
          if (res.data[i].sampleDetailBeans == undefined) {
            res.data[i].sampleDetailBeans = [];
          }
          for (var j in res.data[i].sampleDetailBeans) {
            res.data[i].sampleDetailBeans[j].doHas = true;
          }
        }
        this.sampleTableDate = res.data.map((ele) => {
          ele.isEdit1 = false;
          return ele;
        });
        if (!res.pageinfo) {
          this.rowNumber = 0;
        } else if (res.pageinfo && !res.pageinfo.rowNumber) {
          this.rowNumber = 0;
        } else {
          this.rowNumber = res.pageinfo.rowNumber;
        }
      }
    },
    // 读取用户
    readUser(item) {
      this.$http({
        method: "post",
        apiUrl: "/resource/readEmployeeByLab.htm",
        params: { name: item },
        isJson: true,
      }).then((res) => {
        if (res.code === 0) {
          this.userData = res.data;
          this.checkData = JSON.parse(JSON.stringify(res.data));
          // let index = this.checkData.findIndex((item) => {
          //   return item.account == this.userInfo.loginid;
          // });
          // if (index != -1) {
          //   this.checkData[index].disabled = true;
          // }
        }
      });
    },
    changeSampleState(val) {
      this.readTaskSample(this.sampleQuery);
      // var step = null;
      // if(val == 3){
      //   step = 2
      // }
      // this.readAllTask(step)
    },
    // 搜索栏搜索任务下拉框
    readAllTask() {
      var step = null;
      if (this.sampleStateValue == 3) {
        step = 2;
      }
      this.$http({
        method: "post",
        apiUrl: "/detection/readAllTask.htm",
        params: { step: step },
        isJson: false,
      }).then((res) => {
        if (res.code === 0) {
          this.taskList = res.data;
        }
      });
    },
    // 样品列表勾选的值
    handleSelectionChange(val) {
      let time =
        this.util.date() +
        " " +
        new Date().getHours() +
        ":" +
        new Date().getMinutes() +
        ":" +
        new Date().getSeconds();
        let select = JSON.parse(JSON.stringify(val));
        select.forEach((item) => {
          if(!item.factDate) {
            item.factDate = time;
          }
          if(!item.acceptDate) {
            item.acceptDate = time;
          }
          if(!item.acceptMan) {
            item.acceptMan = this.userInfo.loginid;
            item.acceptManName = this.userInfo.name;
          }
          if(!item.propertyTwo) {
            item.propertyTwo = item.propertyOne;
          }
        });
      this.multipleSelection = JSON.parse(JSON.stringify(select));
      this.samplenum = this.multipleSelection.length;
    },
    // 扫码打印
    scanPrint() {
      this.scanTableShow = true;
      this.acceptOrregist = "accept";
    },
    // 打印样品标签
    printSample() {
      if (this.multipleSelection.length == 0) {
        this.$notify({
          title: "警告",
          message: "请先选中样品",
          type: "warning",
        });
      } else {
        this.printTableShow = true;
        this.acceptOrregist = "accept";
      }
    },
    // 清空table的多选
    toggleSelection(rows) {
      if (rows) {
        rows.forEach((row) => {
          this.$refs.multipleTable.toggleRowSelection(row);
        });
      } else {
        this.$refs.multipleTable.clearSelection();
      }
    },
    recoverReceive() {
      if (this.samplenum == 0) {
        this.$message({
          type: "info",
          message: "请先选中样品!",
        });
      } else {
        let data = this.multipleSelection.map((ele) => {
          // ele.status = 512
          return ele;
        });
        //  /detection/updateSamplesByAccept.htm
        this.$http({
          method: "post",
          apiUrl: "/detection/updateSamplesRecover.htm",
          params: data,
          isJson: true,
          isLoading: true,
        }).then((res) => {
          if (res.code === 0) {
            this.$message({
              type: "success",
              message: "恢复接收!",
            });
            this.readTaskSample(this.sampleQuery);
          }
        });
      }
    },
    // 放弃接收
    abandonReceive() {
      if (this.samplenum == 0) {
        this.$message({
          type: "info",
          message: "请先选中样品!",
        });
      } else {
        let data = this.multipleSelection.map((ele) => {
          ele.status = 513;
          return ele;
        });
        //  /detection/updateSamplesByAccept.htm
        this.$http({
          method: "post",
          apiUrl: "/detection/updateSamplesByAccept.htm",
          params: data,
          isJson: true,
          isLoading: true,
        }).then((res) => {
          if (res.code === 0) {
            this.$message({
              type: "success",
              message: "放弃接收!",
            });
            this.readTaskSample(this.sampleQuery);
          }
        });
      }
    },
    // 销毁弹框
    destroyShow() {
      if (this.samplenum == 0) {
        this.$message({
          type: "info",
          message: "请先选中样品!",
        });
      } else {
        this.destroyDetailShow = true;
        this.isDestroy = true;
        this.setSapmleData();
      }
    },
    //  接收弹框
    acceptShow() {
      if (this.samplenum == 0) {
        this.$message({
          type: "info",
          message: "请先选中样品!",
        });
      } else {
        this.$alert("请不要忘记打印样品标签！", "提示", {
          confirmButtonText: "确定",
          type: "warning",
          callback: (action) => {
            if(action == "confirm") {
              this.$http({
                method: "post",
                apiUrl: "/detection/lockAcceptSample.htm",
                params: this.multipleSelection,
                isJson: true,
              }).then((res) => {
                if (res.code === 0) {
                  this.showBack = true;
                  this.multipleSelections = this.multipleSelection;
                  this.acceptData = this.multipleSelections;
                  this.acceptDialog = true;
                }
              });
            }
          },
        });
      }
    },
    // 取消接收
    disLock() {
      if (this.samplenum == 0) {
        this.$message({
          type: "info",
          message: "请先选中样品!",
        });
      } else {
        let flag = this.multipleSelection.findIndex((item) => {
          return (
            item.acceptManName == "" ||
            item.acceptManName == null ||
            item.acceptManName == undefined
          );
        });
        if (flag == -1) {
          let index = this.multipleSelection.findIndex((item) => {
            return item.acceptManName != this.userInfo.name;
          });
          if (index == -1) {
            this.disLockData(1);
          } else {
            let indexFlag = index + 1;
            this.$notify({
              title: "失败",
              message: "样品锁定人与解锁人不一致",
              type: "error",
            });
          }
        } else {
          let index = flag + 1;
          this.$notify({
            title: "失败",
            message: "样品未被锁定",
            type: "error",
          });
        }
      }
    },
    // 取消接收
    async acceptDisShow() {
      this.disLockData();
      this.acceptDialog = false;
      setTimeout(() => {
        this.close();
      }, 400);
    },
    //取消锁定数据
    disLockData(flag) {
      this.$http({
        method: "post",
        apiUrl: "/detection/unLockAcceptSample.htm",
        params: this.multipleSelection,
        isJson: true,
      }).then((res) => {
        if (res.code === 0) {
          if (flag) {
            this.$message({
              type: "info",
              message: "已取消锁定",
            });
            this.readTaskSample(this.sampleQuery);
          } else {
            return true;
          }
        } else {
          return false;
        }
      });
    },
    //上移或下移
    shiftRow(index, type) {
      if (type == "UP") {
        [this.acceptData[index - 1], this.acceptData[index]] = [
          this.acceptData[index],
          this.acceptData[index - 1],
        ];
      } else {
        [this.acceptData[index], this.acceptData[index + 1]] = [
          this.acceptData[index + 1],
          this.acceptData[index],
        ];
      }
      this.reLoad();
    },
    // 鼠标方在输入框 批量按钮出现
    mouseoverHH(index, row) {
      let newArr = [];
      if (index <= 5) {
        newArr = this.acceptData;
      } else {
        newArr = this.changeData;
      }
      for (var i = 0; i < newArr.length; i++) {
        if (newArr[i] != row) {
          this.$set(newArr[i], "piluru" + index, false);
        } else {
          this.$set(row, "piluru" + index, true);
        }
      }
    },
    // 批量设置编号
    setCode(row, index, code, flag) {
      let newArr = [];
      if (flag) {
        newArr = this.acceptData;
      } else {
        newArr = this.changeData;
      }
      let str = row[code];
      let numArr = str.match(/\d+/g);
      if (numArr && numArr.length) {
        let lastNumber = numArr[numArr.length - 1];
        let numLength = lastNumber.length;
        let strLength = row[code].length - numLength;
        let preStr = row[code].slice(0, strLength);
        for (var i in newArr) {
          if (i > index) {
            lastNumber = parseInt(lastNumber) + 1;
            lastNumber = "" + lastNumber;
            if (lastNumber.length < numLength) {
              lastNumber =
                "0".repeat(numLength - lastNumber.length) + lastNumber;
              this.$set(newArr[i], code, preStr + lastNumber);
              // newArr[i][code] = preStr + lastNumber;
            } else if (lastNumber.length == numLength) {
              this.$set(newArr[i], code, preStr + lastNumber);
              // newArr[i][code] = preStr + lastNumber;
            } else {
              this.$set(newArr[i], code, "");
              // newArr[i][code] = "";
            }
            this.reLoad();
          }
        }
      } else {
        this.$message({
          type: "info",
          message: "样品编号规则为字母+数字!",
        });
        for (var i in newArr) {
          if (i > index) {
            newArr[i][code] = "";
            this.reLoad();
          }
        }
      }
    },
    // 批量设置数据
    piluru(row, index, name, flag) {
      let newArr = [];
      if (flag) {
        newArr = this.acceptData;
      } else {
        newArr = this.changeData;
      }
      for (var i in newArr) {
        if (i > index) {
          this.$set(newArr[i], name, row[name]);
          // newArr[i][name] = row[name];
          this.reLoad();
        }
      }
    },
    //  是否重加载
    reLoad() {
      this.reload = false;
      this.$nextTick(() => {
        this.reload = true;
      });
    },
    // 判断数组中的对象某属性是否存在重复
    getArray(obj, itemName) {
      let info = {
        repeat: false,
        repeatContent: "",
      };
      let objList = []; //去重后数据的新数组
      obj.forEach((item, index) => {
        let flag = true; //建立标记，判断数据是否重复，true为不重复
        objList.forEach((item0, index0) => {
          //循环新数组的内容
          if (item0[itemName] == item[itemName]) {
            //让json数组对象的内容与新数组的内容作比较，相同的话，改变标记为false
            flag = false;
            let repeatIndex = index + 1;
            let repeatIndex0 = index0 + 1;
            info.repeat = true;
            info.repeatContent =
              "序号" +
              repeatIndex0 +
              "与序号" +
              repeatIndex +
              "的样品编号存在重复！";
            return info;
          }
        });
        if (flag) {
          //判断是否重复
          objList.push(item); //不重复的放入新数组。  新数组的内容会继续进行上边的循环。
        }
      });
      return info;
    },
    addRedStar( h, { column }) { 
      return [
        h('span', { style: 'color: red' }, '*'),
        h('span', ' ' + column.label)
      ];
    },
    //接收弹框确定继续接收
    toAccept() {
      let flag = this.acceptData.findIndex((item) => {
        return (
          item.code == null ||
          item.code == "" ||
          item.code.replace(/^\s*|\s*$/g, "") == "" ||
          // item.propertyTwo == "" ||
          // item.factManName == "" ||
          item.factDate == "" ||
          // item.acceptManName == "" ||
          item.acceptDate == "" ||
          // item.propertyTwo == null ||
          // item.factManName == null ||
          item.factDate == null ||
          // item.acceptManName == null ||
          item.acceptDate == null
        );
      });
      if (flag == -1) {
        let info = this.getArray(this.acceptData, "code");
        if (info.repeat) {
          //前端判断目前数据样品编号是否存在重复
          this.$message({
            type: "info",
            message: info.repeatContent,
          });
        } else {
          //后端判断目前数据样品编号与数据库数据是否存在重复
          this.$http({
            method: "post",
            apiUrl: "detection/chekSampleCode.htm",
            params: this.acceptData,
            isJson: true,
          })
            .then((res) => {
              if (res.code == 0) {
                this.acceptDialog = false;
                this.acceptDetailShow = true;
                this.isAccept = true;
                this.setSapmleData();
              }
            })
            .catch((err) => {});
        }
      } else {
        //样品编号为空
        let index = flag + 1;
        this.$notify({
          type: "warning",
          title: "警告",
          message: "序号为" + index + "的样品信息未填写完整!",
        });
      }
    },
    backList() {
      this.acceptDetailShow = false;
      this.acceptDialog = true;
    },
    //申请变更
    changeInfo(flag) {
      if (this.samplenum == 0) {
        this.$message({
          type: "info",
          message: "请先选中样品!",
        });
      } else {
        let info = JSON.parse(sessionStorage.getItem("laboratoryAccountInfo"));
        if (flag == 1) {
          this.multipleSelection.forEach((item) => {
            item.sampleId = item.id;
            item.oldSampleName = item.name;
            item.sampleName = item.name;
            item.oldCode = item.code;
            item.newCode = item.code;
            item.oldPropertyTwo = item.propertyTwo;
            item.oldFactMan = item.factMan;
            item.oldFactManName = item.factManName;
            item.oldFactDate = item.factDate;
            item.oldAcceptMan = item.acceptMan;
            item.oldAcceptManName = item.acceptManName;
            item.oldAcceptDate = item.acceptDate;
            item.applicant = info.name;
          });
        } else {
          this.multipleSelection.forEach((item) => {
            item.applicant = info.name;
          });
        }
        this.changeData = JSON.parse(JSON.stringify(this.multipleSelection));
        this.changeDialog = true;
      }
    },
    //申请变更提交按钮
    toChangeInfo() {
      let flag = this.changeData.findIndex((item) => {
        return (
          item.newCode == null ||
          item.newCode == "" ||
          item.newCode.replace(/^\s*|\s*$/g, "") == "" ||
          item.sampleName == "" ||
          // item.factManName == "" ||
          item.factDate == "" ||
          // item.acceptManName == "" ||
          item.acceptDate == "" ||
          item.chekName == "" ||
          // item.propertyTwo == "" ||
          item.reason == "" ||
          item.sampleName == null ||
          // item.factManName == null ||
          item.factDate == null ||
          // item.acceptManName == null ||
          item.acceptDate == null ||
          item.chekName == null ||
          // item.propertyTwo == null ||
          item.reason == null
        );
      });
      if (flag == -1) {
        let info = this.getArray(this.changeData, "newCode");
        if (info.repeat) {
          //前端判断目前数据样品编号是否存在重复
          this.$message({
            type: "info",
            message: info.repeatContent,
          });
        } else {
          let info = {
            pass: true,
            content: "",
          };
          this.changeData.forEach((item, index) => {
            let obj = JSON.parse(JSON.stringify(item));
            if (item.factManName && typeof item.factManName != "string") {
              item.factMan = obj.factManName.account; //样品采样人账号
              item.factManName = obj.factManName.name; //样品采样人姓名
            }
            if (item.acceptManName && typeof item.acceptManName != "string") {
              item.acceptMan = obj.acceptManName.account; //样品接收人账号
              item.acceptManName = obj.acceptManName.name; //样品接收人姓名
            }
            if (item.chekName && typeof item.chekName != "string") {
              item.chekBy = obj.chekName.account; //样品审批人账号
              item.chekName = obj.chekName.name; //样品审批人姓名
            }
            if (
              item.oldSampleName === item.sampleName &&
              item.oldCode === item.newCode &&
              item.oldPropertyTwo === item.propertyTwo &&
              item.oldFactMan === item.factMan &&
              item.oldFactManName === item.factManName &&
              item.oldFactDate === item.factDate &&
              item.oldAcceptMan === item.acceptMan &&
              item.oldAcceptManName === item.acceptManName &&
              item.oldAcceptDate === item.acceptDate
            ) {
              info.pass = false;
              let indexInfo = index + 1;
              info.content = "序号为" + indexInfo + "的数据没有变更";
            }
          });
          if (info.pass) {
            this.$http({
              method: "post",
              apiUrl: "/detection/changeSampleInfo.htm",
              params: this.changeData,
              isJson: true,
            }).then((res) => {
              if (res.code === 0) {
                this.$message({
                  type: "success",
                  message: "申请变更成功!",
                });
                this.changeDialog = false;
                this.readTaskSample(this.sampleQuery);
                this.findChangeList();
              }
            });
          } else {
            this.$notify({
              type: "warning",
              title: "警告",
              message: info.content,
            });
          }
        }
      } else {
        //样品编号为空
        let index = flag + 1;
        this.$notify({
          type: "warning",
          title: "警告",
          message: "序号为" + index + "的样品信息未填写完整!",
        });
      }
    },
    //取消变更
    closeChange() {
      this.changeDialog = false;
      this.readTaskSample(this.sampleQuery);
    },
    //清空申请变更列表查询条件
    emptyChangeSearch() {
      this.changeQuery.chekName = "";
    },
    toChangeInfos() {
      this.nowTab = "receiveList";
      this.readTaskSample(this.sampleQuery);
    },
    toChangeData() {
      this.changeQuery.chekName = this.userInfo.name;
      this.nowTab = "auditList";
      this.findChangeList();
    },
    //查询申请变更列表
    async findChangeList() {
      this.changeTableDate = [];
      this.isLoading = false;
      let res = await this.$http({
        method: "get",
        apiUrl: "/detection/getChangeList.htm",
        params: this.changeQuery,
      });
      if (res.code === 0) {
        this.isLoading = true;
        this.changeTableDate = res.data;
      }
      if (!res.pageinfo) {
        this.rowNumber = 0;
      } else if (res.pageinfo && !res.pageinfo.rowNumber) {
        this.rowNumber = 0;
      } else {
        this.rowNumber = res.pageinfo.rowNumber;
      }
    },
    //通过或驳回变更申请
    passOrRejected(row, type) {
      this.passOrRejectInfo.type = type;
      this.passOrRejectInfo.pass = "1";
      this.passOrRejectInfo.rejectReason = "";
      this.passOrRejectData = JSON.parse(JSON.stringify(row));
      this.passOrRejectDialog = true;
    },
    //提交通过或驳回变更申请
    toPassOrReject() {
      if (
        this.passOrRejectInfo.pass == "2" &&
        this.passOrRejectInfo.rejectReason == ""
      ) {
        this.$notify({
          title: "警告",
          message: "请填写驳回原因",
          type: "warning",
        });
      } else {
        let obj = {
          id: this.passOrRejectData.id,
          status: this.passOrRejectInfo.pass,
          rejectReason: this.passOrRejectInfo.rejectReason,
        };
        this.$http({
          method: "post",
          apiUrl: "/detection/chekChangeSample.htm",
          params: obj,
          isJson: true,
        }).then((res) => {
          if (res.code == 0) {
            this.$message({
              type: "success",
              message: "操作成功!",
            });
            this.passOrRejectDialog = false;
            this.findChangeList();
          }
        });
      }
    },
    // 上一个或者先一个按钮
    changeSampleNum(edit) {
      if (edit == "add") {
        var sampleDetail =
          this.multipleSelection[this.currentSample].sampleDetailBeans;

        var next = this.validate(
          this.multipleSelection[this.currentSample].sampleDetailBeans
        );
        if (next) {
          this.currentSample++;
        }
        // debugger;
      } else {
        this.currentSample--;
      }
      this.setSapmleData();
    },
    validate(obj) {
      var msg = "";
      var flag = true;
      // debugger
      for (var i in obj) {
        //当前显示样品
        if (!obj[i].doCopy) {
          obj[i].doCopy = false;
        }
        if (!obj[i].doCopyTwo) {
          obj[i].doCopyTwo = false;
        }
        if (
          obj[i].doHas &&
          (obj[i].bottleType == "" || obj[i].capacity == "")
        ) {
          msg = "请填写容器材质和容器容量!";
          break;
        }
        if (obj[i].doHas && obj[i].number < 1) {
          msg = "容器数量必须大于0!";
          break;
        }
        // if (obj[i].doCopy) {
        //   msg = '请填写留样信息';
        //   break;
        // }
        // if (obj[i].doCopyTwo) {
        //   msg = '请填写残样信息';
        //   break;
        // }
      }
      if (msg != "") {
        this.$message({
          type: "info",
          message: msg,
        });
        flag = false;
      }
      return flag;
    },
    validate2(obj) {
      var msg = "";
      var flag = true;
      // debugger
      if (obj.length && obj.length > 0) {
        for (var i in obj) {
          //当前显示样品
          if (obj[i].bottleType == "") {
            msg = "请填写样品材质";
            break;
          }
          if (obj[i].destroyDate == "") {
            msg = "请填写销毁时间";
            break;
          }
          if (obj[i].destroyName == "") {
            msg = "请填写销毁人";
            break;
          }
          if (obj[i].destroyWay == "") {
            msg = "请填写销毁方式";
            break;
          }
        }
      } else {
        flag = false;
        msg = "请选择销毁的样品";
      }
      if (msg != "") {
        this.$message({
          type: "info",
          message: msg,
        });
        flag = false;
      }
      return flag;
    },
    // 设置当前显示的样品数据
    setSapmleData() {
      this.sampleAcceptForm = this.multipleSelections[this.currentSample];

      if (
        this.sampleAcceptForm.acceptDate == undefined ||
        this.sampleAcceptForm.acceptDate == null ||
        this.sampleAcceptForm.acceptDate == ""
      ) {
        // var time = this.util.date() + " " + "00:00:00";
        var time =
          this.util.date() +
          " " +
          new Date().getHours() +
          ":" +
          new Date().getMinutes() +
          ":" +
          new Date().getSeconds();
        this.$set(this.sampleAcceptForm, "acceptDate", time);
      }
      // sampleAcceptForm
      if (
        this.sampleAcceptForm.factDate == undefined ||
        this.sampleAcceptForm.factDate == null ||
        this.sampleAcceptForm.factDate == ""
      ) {
        var time =
          this.util.date() +
          " " +
          new Date().getHours() +
          ":" +
          new Date().getMinutes() +
          ":" +
          new Date().getSeconds();
        this.$set(this.sampleAcceptForm, "factDate", time);
      }
    },
    // 改变复选框值得时候调用得数据
    checkboxChange(row, rows) {
      rows.doHas = row;
      this.$nextTick(() => {
        if (!rows.doHas) {
          for (var i in rows) {
            if (i == "number" || i == "doCopy" || i == "address") {
              this.$set(rows, i, null);
            }
          }
        }
      });
    },
    // 改变复选框值得时候调用得数据
    checkboxChangeTwo(row, rows) {
      rows.doHas = row;
      this.$nextTick(() => {
        if (!rows.doHas) {
          for (var i in rows) {
            if (i == "number" || i == "doCopy" || i == "address") {
              this.$set(rows, i, null);
            }
          }
        }
      });
    },
    //  不留样时留样地址和期限不可用
    checkDoCopyTwo(row, rows) {
      rows.doCopyTwo = row;
      this.$nextTick(() => {
        if (!rows.doCopyTwo) {
          for (var i in rows) {
            if (i == "addressTwo") {
              this.$set(rows, i, null);
            }
          }
        }
      });
    },
    checkBox(row, rows) {
      if (!row) {
        rows.doHas = false;
      }
    },
    //  不留样时留样地址和期限不可用
    checkDoCopy(row, rows) {
      rows.doCopy = row;
      this.$nextTick(() => {
        if (!rows.doCopy) {
          for (var i in rows) {
            if (i == "address") {
              this.$set(rows, i, null);
            }
          }
        }
      });
    },
    // 样品作废
    invalidSample() {
      this.$confirm("是否确定作废", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        // this.disLockData();
        this.sampleAcceptForm.status = this.taskSampleStatus[2].value;
        this.$message({
          type: "success",
          message: "样品作废成功",
        });
        this.reLoad();
      });
    },
    // 查看详情
    samlpeDetail(row) {
      this.showBack = false;
      this.acceptDetailShow = true;
      this.sampleAcceptForm = row;
      this.isAccept = false;
    },
    // 关闭弹框
    closeDestroy() {
      this.toggleSelection();
      this.isDestroy = true;
      this.sampleAcceptForm = {
        factManName: "",
        factMan: "",
        propertyOne: "",
        propertyTwo: "",
        factDate: "",
        acceptDate:
          this.util.date() +
          " " +
          new Date().getHours() +
          ":" +
          new Date().getMinutes() +
          ":" +
          new Date().getSeconds(),
        acceptMan: "",
        acceptManName: "",
      };
      this.currentSample = 0;
      this.destroyDetailShow = false;
      this.readTaskSample(this.sampleQuery);
    },
    // 关闭弹框
    close() {
      this.toggleSelection();
      this.isRepeat = true;
      this.sampleAcceptForm = {
        factManName: "",
        factMan: "",
        propertyOne: "",
        propertyTwo: "",
        factDate: "",
        acceptDate:
          this.util.date() +
          " " +
          new Date().getHours() +
          ":" +
          new Date().getMinutes() +
          ":" +
          new Date().getSeconds(),
        acceptMan: "",
        acceptManName: "",
      };
      this.currentSample = 0;
      this.acceptDetailShow = false;
      this.readTaskSample(this.sampleQuery);
    },
    // 提交销毁
    subDestroy() {
      // data.acceptMan = this.multipleSelection[i].acceptManName.account; //样品接收人账号
      // data.acceptManName = this.multipleSelection[i].acceptManName.name;  //样品接收人姓名
      this.$confirm("是否销毁", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          let newArr = [];
          for (let i in this.multipleSelection) {
            let data = {};
            data = this.multipleSelection[i];
            // data.status = 519; //样品作废得为512

            let sampleBottleList = this.multipleSelection[
              i
            ].sampleDetailBeans.filter((ele) => ele.doHas); //样品容器
            for (let m in sampleBottleList) {
              for (let n in this.bottleOptions) {
                if (
                  sampleBottleList[m].bottleType == this.bottleOptions[n].id
                ) {
                  sampleBottleList[m].bottleName = this.bottleOptions[n].name;
                }
              }
              sampleBottleList[m].destroyBy =
                sampleBottleList[m].destroyName.account;
              sampleBottleList[m].destroyName =
                sampleBottleList[m].destroyName.name;
            }

            let next = this.validate2(
              this.multipleSelection[i].sampleDetailBeans.filter(
                (ele) => ele.doHas
              )
            );
            if (next) {
              data.sampleDetailBeans = sampleBottleList;
              newArr.push(data);
            } else {
              return;
            }
          }

          this.isRepeat = false;
          this.$http({
            method: "post",
            apiUrl: "/detection/updateSamplesByDestroy.htm",
            params: newArr,
            isJson: true,
            isLoading: true,
          }).then((res) => {
            this.isRepeat = true;
            if (res.code === 0) {
              this.$message({
                type: "success",
                message: "销毁成功!",
              });
              this.readTaskSample(this.sampleQuery);
              this.closeDestroy();
            }
          });
        })
        .catch((e) => {
          // console.log(e)
          this.$message({
            type: "info",
            message: "已取消接收",
          });
        });
    },
    // 提交接收
    subAccept() {
      this.$confirm("是否接收", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          var newArr = [];
          for (var i in this.multipleSelection) {
            var name = this.multipleSelection[i].name;
            var factDate = new Date(
              this.multipleSelection[i].factDate
            ).getTime();
            var acceptDate = new Date(
              this.multipleSelection[i].acceptDate
            ).getTime();
            if (factDate > acceptDate) {
              this.$notify({
                type: "warning",
                title: "警告",
                message: '"' + name + '"' + "接样时间要大于采样时间!",
              });
              return;
            }
            var data = {};
            data.id = this.multipleSelection[i].id; //每个样品id
            data.code = this.multipleSelection[i].code; //每个样品编码
            if (typeof this.multipleSelection[i].acceptManName == "string") {
              data.acceptMan = this.multipleSelection[i].acceptMan; //样品接收人账号
              data.acceptManName = this.multipleSelection[i].acceptManName; //样品接收人姓名
            }
            if (data.acceptMan == undefined) {
              //如果没有填写样品接收人，默认当前登陆用户
              data.acceptMan = this.multipleSelection[i].acceptMan;
              data.acceptManName = this.multipleSelection[i].acceptManName;
            }
            data.acceptDate = this.multipleSelection[i].acceptDate; //样品接收时间
            var h =
              new Date().getHours() < 10
                ? "0" + new Date().getHours()
                : new Date().getHours();
            var m =
              new Date().getMinutes() < 10
                ? "0" + new Date().getMinutes()
                : new Date().getMinutes();
            var s =
              new Date().getSeconds() < 10
                ? "0" + new Date().getSeconds()
                : new Date().getSeconds();
            if (
              data.acceptDate == undefined ||
              data.acceptDate == "" ||
              data.acceptDate == null
            ) {
              data.acceptDate = this.util.date() + " " + h + ":" + m + ":" + s;
            }

            // data.acceptDate = this.multipleSelection[i].acceptDate;  //样品接收时间
            if (
              this.multipleSelection[i].factDate != undefined &&
              this.multipleSelection[i].factDate != null &&
              this.multipleSelection[i].factDate != ""
            ) {
              data.factDate = this.multipleSelection[i].factDate.split(".")[0];
            } else {
              data.factDate = this.util.date() + " " + h + ":" + m + ":" + s;
            }

            data.propertyTwo = this.multipleSelection[i].propertyTwo; //接收时样品性状
            // if (this.multipleSelection[i].status != 513) {
            //   data.status = 512; //点击接收,修改样品状态为待领取513
            // } else {
            //   data.status = 513; //样品作废得为512
            // }
            if(this.multipleSelection[i].status != 512){
               data.status = 513; //点击接收,修改样品状态为待领取513
            }else{
              data.status = 512; //样品作废得为512
            }

            var sampleBottleList = this.multipleSelection[i].sampleDetailBeans; //样品容器
            for (var m in sampleBottleList) {
              for (var n in this.bottleOptions) {
                if (
                  sampleBottleList[m].bottleType == this.bottleOptions[n].id
                ) {
                  sampleBottleList[m].bottleName = this.bottleOptions[n].name;
                }
              }
            }
            var arr = [];
            var next = this.validate(
              this.multipleSelection[i].sampleDetailBeans
            );
            if (next) {
              data.sampleDetailBeans =
                this.multipleSelection[i].sampleDetailBeans;
            } else {
              return;
            }
            newArr.push(data);
          }
          // return;
          // console.log(newArr)
          this.isRepeat = false;
          this.$http({
            method: "post",
            apiUrl: "/detection/updateSamplesByAccept.htm",
            params: newArr,
            isJson: true,
            isLoading: true,
          }).then((res) => {
            this.isRepeat = true;
            if (res.code === 0) {
              this.$message({
                type: "success",
                message: "提交成功!",
              });
              this.getMessage(newArr);
              this.readTaskSample(this.sampleQuery);
              this.close();
            }
          });
        })
        .catch((e) => {
          // console.log(e)
          this.$message({
            type: "info",
            message: "已取消接收",
          });
        });
    },
    getMessage(arr) {
      this.$http({
        method: "post",
        apiUrl: "/detection/messageByAccept.htm",
        params: arr,
        isJson: true,
      }).then((res) => {
        if (res.code === 0) {
        }
      });
    },
    // 每个容器的样品新增一条
    addbottletype() {
      this.sampleAcceptForm.sampleDetailBeans.push({
        bottleType: "",
        number: "1",
        doCopy: false,
        doCopyTwo: false,
        capacity: "100",
        address: "",
        addressTwo: "",
        doMust: false,
        doHas: true,
        media: "",
        saveTime: "",
      });
    },
    // 每个容器的样品新增一条
    addbottletypeTwo() {
      this.sampleAcceptForm.sampleDetailBeans.push({
        bottleType: "",
        number: "1",
        doCopy: false,
        doCopyTwo: false,
        capacity: "100",
        address: "",
        addressTwo: "",
        doMust: false,
        doHas: false,
        media: "",
        saveTime: "",
      });
    },
    // 删除样品容器
    deletebottle(index) {
      this.sampleAcceptForm.sampleDetailBeans.splice(index, 1);
    },
    // 设置分页的大小
    handleSizeChange(val) {
      this.sampleQuery.pageCount = val;
    },
    // 当前是第几页
    handleCurrentChange(val) {
      this.sampleQuery.page = val;
    },
  },
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.mainCon {
  height: calc(100% - 41px);
}
.searchitem {
  width: calc(100% / 4);
  padding: 0;
  margin-right: 5px;
}

.searchitem .informationItem {
  width: calc(100% - 78px);
  float: none;
  margin-left: 8px;
}
.passOrRejectDialog .content {
  margin: 20px 30px;
}
.passOrRejectDialog .content-flex {
  display: flex;
  border: 2px solid #e4e7ed;
}
.passOrRejectDialog .no-top {
  border-top: none;
}
.passOrRejectDialog .content-flex .twoTitle {
  align-self: center;
  width: 85px !important;
  text-align: center;
}
.passOrRejectDialog .content-flex .form {
  flex-grow: 1;
  border-left: 2px solid #e4e7ed;
  padding: 10px 20px 10px 0;
}
.passOrRejectDialog .content-flex .el-form-item {
  margin-bottom: 5px;
}
.addSampleForm .el-dialog .el-dialog__body .form .el-form-item {
  width: 49%;
  display: inline-block;
}

.addSampleForm .el-dialog .el-dialog__body .form .el-form-item {
  width: 33%;
  display: inline-block;
}
</style>
<style>
.samplereceptionDialog .form {
  height: 208px;
  padding: 10px;
}

.samplereceptionDialog .el-form-item {
  width: 49%;
  display: inline-block;
  margin-bottom: 10px;
}

.samplereceptionDialog .addbottle {
  padding: 10px 20px 0px 20px;
}

.samplereceptionDialog .penalrow {
  padding: 10px 20px 0px 20px;
  height: calc(100% - 250px);
}

/*.selectTable .el-table__header thead th:nth-of-type(1) .cell {
    display: none;
  }*/

.el-message .el-message--info {
  display: block;
}

.capacity.el-input-number span {
  display: none;
}
.feiqiRed.el-select .el-input .el-input__inner {
  color: red !important;
}
.acceptDialog .el-dialog {
  height: 70%;
}
.acceptDialog .el-dialog__body tbody tr .buttonPiluru {
  position: absolute;
  right: -3%;
  z-index: 100;
}
.btn-hover:hover {
  cursor: pointer;
}
.passOrRejectDialog .redText .el-input__inner {
  color: red !important;
}
</style>